package com.qf.cx.simplenms.link.model;
/*
 * 车牌中的中文编码信息
 */

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;

public class ChineseChar {
	
	private static final Logger LOG = Logger.getLogger(ChineseChar.class);	
	
	private static final String[] province = {"京","津","冀","晋","蒙","辽", "吉",
		                                     "黑","沪","苏","浙","皖","闽","赣",
		                                     "鲁","豫","鄂","湘","粤","桂","琼",
		                                     "渝","川","贵","云","藏","陕","甘",
		                                     "青","宁","新","港","澳"};
    private static final String[][] carColor = {{"0","白色"} ,{"1","灰色"},{"2","黄色"},{"3","粉色"},{"4","红色"},
									    	   {"5","紫色"} ,{"6","绿色"},{"7","蓝色"},{"8","棕色"},{"9","黑色"},
									    	   {"15","无色"}, {"15","无色"},{"15","无色"},{"15","无色"},{"15","其他"}};
   
    private static final String[] code = {"A","B","C","D","E","F","G",
    		                             "H","I","G","K","L","M","N",
    		                             "O","P","Q","R","S","T","U", 
    		                             "V","W","X","Y","Z"};
    private static final String[] carSerNum = {"A","B","C","D","E","F","G",
								              "H","I","G","K","L","M","N",
								              "O","P","Q","R","S","T","U", 
								              "V","W","X","Y","Z",
								              "0","1","2","3","4","5","6",
								              "7","8","9"};
    private static final String[][] carUseType = {{"1","公路客运、旅游客运"},{"2","公交客运"},{"3","出租客运"},{"4","货运"},{"5","租赁"},{"7","未知"},
									    		{"7","其他"},{"8","非营运"},{"7","未知"} ,{"7","未知"} ,{"7","未知"} ,{"12","警用、消防、救护、工程抢险"},
									    		{"13","幼儿校车、小学生校车、其他校车"},{"14","危险品运输"},{"15","教练车"}};
    private static final String[][] carPlateType = {{"0","其他车辆"},{"1","大型汽车"},{"2","小型汽车"},{"3","使馆汽车"},{"4","领馆汽车"},{"5","境外汽车"},
										    	   {"6","外籍汽车"},{"7","低速车"},{"8","教练汽车"},{"9","摩托车"},{"10","新能源汽车"},{"11","警用汽车"},
										    	   {"12","港澳两地车"},{"13","武警车辆"},{"14","军队车辆"}};
    
    private static final Map<Integer,String> carTypeMap = new HashMap<Integer,String>();
    
    static {
    	carTypeMap.put(0x1, "K11");
    	carTypeMap.put(0x2, "K12");
    	carTypeMap.put(0x3, "K13");
    	carTypeMap.put(0x4, "K14");
    	carTypeMap.put(0x5, "K15");
    	carTypeMap.put(0x6, "K16");
    	carTypeMap.put(0x7, "K17");
    	carTypeMap.put(0x8, "K18");
    	carTypeMap.put(0x9, "K21");
    	carTypeMap.put(0xa, "K22");
    	carTypeMap.put(0xb, "K23");
    	carTypeMap.put(0xc, "K24");
    	carTypeMap.put(0xd, "K25");
    	carTypeMap.put(0xe, "K26");
    	carTypeMap.put(0xf, "K27");
    	carTypeMap.put(0x10, "K28");
    	carTypeMap.put(0x11, "K31");
    	carTypeMap.put(0x12, "K32");
    	carTypeMap.put(0x13, "K33");
    	carTypeMap.put(0x14, "K34");
    	carTypeMap.put(0x15, "K38");
    	carTypeMap.put(0x16, "K39");
    	carTypeMap.put(0x17, "K41");
    	carTypeMap.put(0x18, "K42");
    	carTypeMap.put(0x19, "K43");
    	carTypeMap.put(0x1a, "K49");
    	carTypeMap.put(0x40, "Q11");
    	carTypeMap.put(0x41, "Q12");
    	carTypeMap.put(0x42, "Q21");
    	carTypeMap.put(0x43, "Q22");
    	carTypeMap.put(0x44, "Q31");
    	carTypeMap.put(0x45, "Q32");
    	carTypeMap.put(0x50, "Z11");
    	carTypeMap.put(0x51, "Z12");
    	carTypeMap.put(0x52, "Z21");
    	carTypeMap.put(0x53, "Z22");
    	carTypeMap.put(0x54, "Z31");
    	carTypeMap.put(0x55, "Z32");
    	carTypeMap.put(0x56, "Z41");
    	carTypeMap.put(0x57, "Z42");
    	carTypeMap.put(0x58, "Z51");
    	carTypeMap.put(0x59, "Z52");
    	carTypeMap.put(0x5a, "Z71");
    	carTypeMap.put(0x5b, "Z72");
    	carTypeMap.put(0x60, "M11");
    	carTypeMap.put(0x61, "M12");
    	carTypeMap.put(0x62, "M13");
    	carTypeMap.put(0x63, "M14");
    	carTypeMap.put(0x64, "M15");
    	carTypeMap.put(0x65, "M21");
    	carTypeMap.put(0x66, "M22");
    	carTypeMap.put(0x68, "D11");
    	carTypeMap.put(0x69, "D12");
    	carTypeMap.put(0x6a, "N11");
    	carTypeMap.put(0x6b, "J11");
    	carTypeMap.put(0x6c, "J12");
    	carTypeMap.put(0x6d, "J13");
    	carTypeMap.put(0x80, "H11");
    	carTypeMap.put(0x81, "H12");
    	carTypeMap.put(0x82, "H13");
    	carTypeMap.put(0x83, "H14");
    	carTypeMap.put(0x84, "H15");
    	carTypeMap.put(0x85, "H16");
    	carTypeMap.put(0x86, "H17");
    	carTypeMap.put(0x87, "H18");
    	carTypeMap.put(0x88, "H19");
    	carTypeMap.put(0x89, "H1A");
    	carTypeMap.put(0x8a, "H1B");
    	carTypeMap.put(0x8b, "H1C");
    	carTypeMap.put(0x8c, "H1D");
    	carTypeMap.put(0x8d, "H1E");
    	carTypeMap.put(0x8e, "H1F");
    	carTypeMap.put(0x8f, "H1G");
    	carTypeMap.put(0x90, "H21");
    	carTypeMap.put(0x91, "H22");
    	carTypeMap.put(0x92, "H23");
    	carTypeMap.put(0x93, "H24");
    	carTypeMap.put(0x94, "H25");
    	carTypeMap.put(0x95, "H26");
    	carTypeMap.put(0x96, "H27");
    	carTypeMap.put(0x97, "H28");
    	carTypeMap.put(0x98, "H29");
    	carTypeMap.put(0x99, "H2A");
    	carTypeMap.put(0x9a, "H2B");
    	carTypeMap.put(0x9b, "H2C");
    	carTypeMap.put(0x9c, "H2D");
    	carTypeMap.put(0x9d, "H2E");
    	carTypeMap.put(0x9e, "H2F");
    	carTypeMap.put(0x9f, "H2G");
    	carTypeMap.put(0xa0, "H31");
    	carTypeMap.put(0xa1, "H32");
    	carTypeMap.put(0xa2, "H33");
    	carTypeMap.put(0xa3, "H34");
    	carTypeMap.put(0xa4, "H35");
    	carTypeMap.put(0xa5, "H37");
    	carTypeMap.put(0xa6, "H38");
    	carTypeMap.put(0xa7, "H39");
    	carTypeMap.put(0xa8, "H3A");
    	carTypeMap.put(0xa9, "H3B");
    	carTypeMap.put(0xaa, "H3C");
    	carTypeMap.put(0xab, "H3D");
    	carTypeMap.put(0xac, "H3F");
    	carTypeMap.put(0xad, "H3G");
    	carTypeMap.put(0xae, "H41");
    	carTypeMap.put(0xaf, "H42");
    	carTypeMap.put(0xb0, "H43");
    	carTypeMap.put(0xb1, "H44");
    	carTypeMap.put(0xb2, "H45");
    	carTypeMap.put(0xb3, "H46");
    	carTypeMap.put(0xb4, "H47");
    	carTypeMap.put(0xb5, "H4A");
    	carTypeMap.put(0xb6, "H4B");
    	carTypeMap.put(0xb7, "H4C");
    	carTypeMap.put(0xb8, "H4F");
    	carTypeMap.put(0xb9, "H4G");
    	carTypeMap.put(0xba, "H51");
    	carTypeMap.put(0xbb, "H52");
    	carTypeMap.put(0xbc, "H53");
    	carTypeMap.put(0xbd, "H54");
    	carTypeMap.put(0xbe, "H55");
    	carTypeMap.put(0xbf, "H5B");
    	carTypeMap.put(0xc0, "H5C");
    	carTypeMap.put(0x100, "G11");
    	carTypeMap.put(0x101, "G12");
    	carTypeMap.put(0x102, "G13");
    	carTypeMap.put(0x103, "G14");
    	carTypeMap.put(0x104, "G15");
    	carTypeMap.put(0x105, "G16");
    	carTypeMap.put(0x106, "G17");
    	carTypeMap.put(0x107, "G18");
    	carTypeMap.put(0x108, "G19");
    	carTypeMap.put(0x109, "G1A");
    	carTypeMap.put(0x10a, "G1B");
    	carTypeMap.put(0x10b, "G1C");
    	carTypeMap.put(0x10c, "G1D");
    	carTypeMap.put(0x10d, "G1E");
    	carTypeMap.put(0x10e, "G1F");
    	carTypeMap.put(0x10f, "G21");
    	carTypeMap.put(0x110, "G22");
    	carTypeMap.put(0x111, "G23");
    	carTypeMap.put(0x112, "G24");
    	carTypeMap.put(0x113, "G25");
    	carTypeMap.put(0x114, "G26");
    	carTypeMap.put(0x115, "G27");
    	carTypeMap.put(0x116, "G28");
    	carTypeMap.put(0x117, "G29");
    	carTypeMap.put(0x118, "G2A");
    	carTypeMap.put(0x119, "G2B");
    	carTypeMap.put(0x11a, "G2C");
    	carTypeMap.put(0x11b, "G2D");
    	carTypeMap.put(0x11c, "G2E");
    	carTypeMap.put(0x11d, "G2F");
    	carTypeMap.put(0x11e, "G31");
    	carTypeMap.put(0x11f, "G32");
    	carTypeMap.put(0x120, "G33");
    	carTypeMap.put(0x121, "G34");
    	carTypeMap.put(0x122, "G35");
    	carTypeMap.put(0x123, "G36");
    	carTypeMap.put(0x124, "G37");
    	carTypeMap.put(0x125, "G38");
    	carTypeMap.put(0x126, "G3A");
    	carTypeMap.put(0x127, "G3B");
    	carTypeMap.put(0x128, "G3C");
    	carTypeMap.put(0x129, "G3D");
    	carTypeMap.put(0x12a, "G3E");
    	carTypeMap.put(0x12b, "G3F");
    	carTypeMap.put(0x180, "B11");
    	carTypeMap.put(0x181, "B12");
    	carTypeMap.put(0x182, "B13");
    	carTypeMap.put(0x183, "B14");
    	carTypeMap.put(0x184, "B15");
    	carTypeMap.put(0x185, "B16");
    	carTypeMap.put(0x186, "B17");
    	carTypeMap.put(0x187, "B18");
    	carTypeMap.put(0x188, "B19");
    	carTypeMap.put(0x189, "B1A");
    	carTypeMap.put(0x18a, "B1B");
    	carTypeMap.put(0x18b, "B1C");
    	carTypeMap.put(0x18c, "B1D");
    	carTypeMap.put(0x18d, "B1E");
    	carTypeMap.put(0x18e, "B1F");
    	carTypeMap.put(0x18f, "B1G");
    	carTypeMap.put(0x190, "B1H");
    	carTypeMap.put(0x191, "B1J");
    	carTypeMap.put(0x192, "B1K");
    	carTypeMap.put(0x193, "B1U");
    	carTypeMap.put(0x194, "B1V");
    	carTypeMap.put(0x195, "B1W");
    	carTypeMap.put(0x196, "B21");
    	carTypeMap.put(0x197, "B22");
    	carTypeMap.put(0x198, "B23");
    	carTypeMap.put(0x199, "B24");
    	carTypeMap.put(0x19a, "B25");
    	carTypeMap.put(0x19b, "B26");
    	carTypeMap.put(0x19c, "B27");
    	carTypeMap.put(0x19d, "B28");
    	carTypeMap.put(0x19e, "B29");
    	carTypeMap.put(0x19f, "B2A");
    	carTypeMap.put(0x1a0, "B2B");
    	carTypeMap.put(0x1a1, "B2C");
    	carTypeMap.put(0x1a2, "B2D");
    	carTypeMap.put(0x1a3, "B2E");
    	carTypeMap.put(0x1a4, "B2F");
    	carTypeMap.put(0x1a5, "B2G");
    	carTypeMap.put(0x1a6, "B2H");
    	carTypeMap.put(0x1a7, "B2J");
    	carTypeMap.put(0x1a8, "B2K");
    	carTypeMap.put(0x1a9, "B2U");
    	carTypeMap.put(0x1aa, "B2V");
    	carTypeMap.put(0x1ab, "B2W");
    	carTypeMap.put(0x1ac, "B31");
    	carTypeMap.put(0x1ad, "B32");
    	carTypeMap.put(0x1ae, "B33");
    	carTypeMap.put(0x1af, "B34");
    	carTypeMap.put(0x1b0, "B35");
    	carTypeMap.put(0x1b1, "B36");
    	carTypeMap.put(0x1b2, "B37");
    	carTypeMap.put(0x1b3, "B38");
    	carTypeMap.put(0x1b4, "B39");
    	carTypeMap.put(0x1b5, "B3C");
    	carTypeMap.put(0x1b6, "B3D");
    	carTypeMap.put(0x1b7, "B3E");
    	carTypeMap.put(0x1b8, "B3F");
    	carTypeMap.put(0x1b9, "B3G");
    	carTypeMap.put(0x1ba, "B3H");
    	carTypeMap.put(0x1bb, "B3J");
    	carTypeMap.put(0x1bc, "B3K");
    	carTypeMap.put(0x1bd, "B3U");
    	carTypeMap.put(0x1be, "B3V");
    	carTypeMap.put(0x1bf, "B3W");
    	carTypeMap.put(0x0, "X99");
    }
    
    public static String getProvince(int code)
    {
    	if(code < 1 || code > province.length)//由于code会减1，所以此处不包括=
    	{
    		LOG.error("get province err,code " + code);
    		return  null;
    	}
    	
    	return province[code - 1];
    }
    
    public static String getCarCode(int cd)
    {
    	if(cd < 0 || cd >= code.length )
    	{
    		LOG.error("get car code err,code " + cd);
    		return  null;    		
    	}
    	return code[cd];   	
    }
    
    public static String getCarColor(int code,int sel)
    {
    	if(code < 0 || code >= carColor.length )
    	{
    		LOG.error("get car color err,code " + code);
    		return  null;    		
    	}
    	
    	return carColor[code][sel];
    }
    
    public static String getCarType(int code, int sel)
    {
    	if(!carTypeMap.containsKey(code))
    	{
    		LOG.error("get car type err,code " + code);
    		return  null;
    	}
    	return carTypeMap.get(code);
    }
    
    public static String getCarUseType(int code,int sel)
    {
    	
    	if(code < 1 || code >  carUseType.length )
    	{
    		LOG.error("get car use type err,code " + code);
    		return  null;    		
    	}
    	
    	return carUseType[code - 1][sel];   	
    }
    
    public static String getCarPlateType(int code,int sel)
    {
    	if(code < 0 || code >= carPlateType.length )
    	{
    		LOG.error("get car plate type err,code " + code);
    		return  null;    		
    	}
    	
    	return carPlateType[code][sel];
    }
    
    public static String getCarSerNum(int code)
    {
    	if(code < 0 || code >= carSerNum.length )
    	{
    		LOG.error("get car ser num err,code " + code);
    		return  null;    		
    	}
    	
    	return carSerNum[code];   	
    }
}
